package com.htx.zqs.blesmartmask.utils;

import com.htx.zqs.blesmartmask.bean.EventBean;

import org.greenrobot.eventbus.EventBus;

/**
 * Created by KomoriWu
 * on 2019/2/17.
 */



public class EventBusUtil {

    public static void register(Object subscriber) {
        if (!EventBus.getDefault().isRegistered(subscriber)) {
            EventBus.getDefault().register(subscriber);
        }
    }

    public static void unregister(Object subscriber) {
        if (EventBus.getDefault().isRegistered(subscriber)) {
            EventBus.getDefault().unregister(subscriber);
        }
    }

    public static void sendEvent(EventBean event) {
        EventBus.getDefault().post(event);
    }

    public static void sendStickyEvent(EventBean event) {
        EventBus.getDefault().postSticky(event);
    }

    // 其他
}
